<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Module swc_kv</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
</head>
<body bgcolor="white">
<div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<hr>

<h1>Module swc_kv</h1>
<ul class="index"><li><a href="#description">Description</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>
     An Erlang implementation of Key-Value Logical Clock,
     in this case a Dotted Causal Container.

<p><b>Authors:</b> Ricardo Gonçalves (<a href="mailto:tome.wave@gmail.com"><tt>tome.wave@gmail.com</tt></a>).</p>

<h2><a name="description">Description</a></h2>
     An Erlang implementation of Key-Value Logical Clock,
     in this case a Dotted Causal Container.
<h2><a name="index">Function Index</a></h2>
<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#add-2">add/2</a></td><td>Adds the dots corresponding to each version in the DCC to the BVV; this
  is accomplished by using the standard fold higher-order function, passing
  the function swc_node:add/2 defined over BVV and dots, the BVV, and the list of
  dots in the DCC.</td></tr>
<tr><td valign="top"><a href="#add-3">add/3</a></td><td>This function is to be used at node I after dcc:discard/2, and adds a
  mapping, from the Dot (I, N) (which should be obtained by previously applying
  swc_node:event/2 to the BVV at node I) to the Value, to the DCC, and also advances
  the i component of the VV in the DCC to N.</td></tr>
<tr><td valign="top"><a href="#context-1">context/1</a></td><td>Returns the causal context of a DCC, which is representable as a
  Version Vector.</td></tr>
<tr><td valign="top"><a href="#discard-2">discard/2</a></td><td>It discards versions in DCC {D,V} which are made obsolete by a causal
  context (a version vector) C, and also merges C into DCC causal context V.</td></tr>
<tr><td valign="top"><a href="#fill-2">fill/2</a></td><td>Function fill adds back causality information to a stripped DCC, before
  any operation is performed.</td></tr>
<tr><td valign="top"><a href="#fill-3">fill/3</a></td><td>Same as fill/2 but only adds entries that are elements of a list of Ids,
  instead of adding all entries in the BVV.</td></tr>
<tr><td valign="top"><a href="#new-0">new/0</a></td><td>Constructs a new clock set without causal history,
  and receives one value that goes to the anonymous list.</td></tr>
<tr><td valign="top"><a href="#strip-2">strip/2</a></td><td>It discards all entries from the version vector V in the DCC that are
  covered by the corresponding base component of the BVV B; only entries with
  greater sequence numbers are kept.</td></tr>
<tr><td valign="top"><a href="#sync-2">sync/2</a></td><td>Performs the synchronization of two DCCs; it discards versions (
  {dot,value} pairs) made obsolete by the other DCC, by preserving the
  versions that are present in both, together with the versions in either of
  them that are not covered by the relevant entry in the other's causal
  context; the causal context is obtained by a standard version vector merge
  function (performing the pointwise maximum).</td></tr>
<tr><td valign="top"><a href="#values-1">values/1</a></td><td>Returns the set of values held in the DCC.</td></tr>
</table>

<h2><a name="functions">Function Details</a></h2>

<h3 class="function"><a name="add-2">add/2</a></h3>
<div class="spec">
<p><tt>add(BVV::<a href="#type-bvv">bvv()</a>, X2::<a href="#type-dcc">dcc()</a>) -&gt; <a href="#type-bvv">bvv()</a></tt><br></p>
</div><p>Adds the dots corresponding to each version in the DCC to the BVV; this
  is accomplished by using the standard fold higher-order function, passing
  the function swc_node:add/2 defined over BVV and dots, the BVV, and the list of
  dots in the DCC.</p>

<h3 class="function"><a name="add-3">add/3</a></h3>
<div class="spec">
<p><tt>add(X1::<a href="#type-dcc">dcc()</a>, Dot::{<a href="#type-id">id()</a>, <a href="#type-counter">counter()</a>}, Value::<a href="#type-value">value()</a>) -&gt; <a href="#type-dcc">dcc()</a></tt><br></p>
</div><p>This function is to be used at node I after dcc:discard/2, and adds a
  mapping, from the Dot (I, N) (which should be obtained by previously applying
  swc_node:event/2 to the BVV at node I) to the Value, to the DCC, and also advances
  the i component of the VV in the DCC to N.</p>

<h3 class="function"><a name="context-1">context/1</a></h3>
<div class="spec">
<p><tt>context(X1::<a href="#type-dcc">dcc()</a>) -&gt; <a href="#type-vv">vv()</a></tt><br></p>
</div><p>Returns the causal context of a DCC, which is representable as a
  Version Vector.</p>

<h3 class="function"><a name="discard-2">discard/2</a></h3>
<div class="spec">
<p><tt>discard(X1::<a href="#type-dcc">dcc()</a>, C::<a href="#type-vv">vv()</a>) -&gt; <a href="#type-dcc">dcc()</a></tt><br></p>
</div><p>It discards versions in DCC {D,V} which are made obsolete by a causal
  context (a version vector) C, and also merges C into DCC causal context V.</p>

<h3 class="function"><a name="fill-2">fill/2</a></h3>
<div class="spec">
<p><tt>fill(X1::<a href="#type-dcc">dcc()</a>, BVV::<a href="#type-bvv">bvv()</a>) -&gt; <a href="#type-dcc">dcc()</a></tt><br></p>
</div><p>Function fill adds back causality information to a stripped DCC, before
  any operation is performed.</p>

<h3 class="function"><a name="fill-3">fill/3</a></h3>
<div class="spec">
<p><tt>fill(X1::<a href="#type-dcc">dcc()</a>, BVV::<a href="#type-bvv">bvv()</a>, Ids::[<a href="#type-id">id()</a>]) -&gt; <a href="#type-dcc">dcc()</a></tt><br></p>
</div><p>Same as fill/2 but only adds entries that are elements of a list of Ids,
  instead of adding all entries in the BVV.</p>

<h3 class="function"><a name="new-0">new/0</a></h3>
<div class="spec">
<p><tt>new() -&gt; <a href="#type-dcc">dcc()</a></tt><br></p>
</div><p>Constructs a new clock set without causal history,
  and receives one value that goes to the anonymous list.</p>

<h3 class="function"><a name="strip-2">strip/2</a></h3>
<div class="spec">
<p><tt>strip(X1::<a href="#type-dcc">dcc()</a>, B::<a href="#type-bvv">bvv()</a>) -&gt; <a href="#type-dcc">dcc()</a></tt><br></p>
</div><p>It discards all entries from the version vector V in the DCC that are
  covered by the corresponding base component of the BVV B; only entries with
  greater sequence numbers are kept. The idea is that DCCs are stored after
  being stripped of their causality information that is already present in the
  node clock BVV.</p>

<h3 class="function"><a name="sync-2">sync/2</a></h3>
<div class="spec">
<p><tt>sync(X1::<a href="#type-dcc">dcc()</a>, X2::<a href="#type-dcc">dcc()</a>) -&gt; <a href="#type-dcc">dcc()</a></tt><br></p>
</div><p>Performs the synchronization of two DCCs; it discards versions (
  {dot,value} pairs) made obsolete by the other DCC, by preserving the
  versions that are present in both, together with the versions in either of
  them that are not covered by the relevant entry in the other's causal
  context; the causal context is obtained by a standard version vector merge
  function (performing the pointwise maximum).</p>

<h3 class="function"><a name="values-1">values/1</a></h3>
<div class="spec">
<p><tt>values(X1::<a href="#type-dcc">dcc()</a>) -&gt; [<a href="#type-value">value()</a>]</tt><br></p>
</div><p>Returns the set of values held in the DCC.</p>
<hr>

<div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<p><i>Generated by EDoc, Oct 29 2015, 16:20:19.</i></p>
</body>
</html>
